package fx.game.demo.window;

import fx.game.demo.common.*;
import fx.game.demo.event.GameEvent;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;


/**
 *
 * @author: datom
 *
 * @create: 2021/11/30 16:36
 *
 * @Deprecated 主页面
 *
 **/
public class MainWindow extends Application{

    @Override
    public void start(Stage primaryStage) throws Exception {
        HyperlinkManage.setApplication(this);
        Stage mainWindow = WindowManage.getMainWindow();
        mainWindow.setTitle(BaseMeta.TITLE);
        mainWindow.setFullScreen(false);

        //设置图标
        mainWindow.getIcons().add(GameResource.getAppIcon());

        mainWindow.setHeight(BaseMeta.MAIN_WINDOW_HEIGHT);
        mainWindow.setWidth(BaseMeta.MAIN_WINDOW_WIDTH);

        //禁止放大或者缩小窗口
        mainWindow.setResizable(false);

        //设置场景
        Scene scene = new Scene(LayoutManage.getMainLayout());

        //场景监听游戏事件
        scene.setOnKeyPressed(GameEvent.getOperatingGameKeyboardEvents());

        mainWindow.setScene(scene);

        mainWindow.show();
    }
    
    
}
